<?php

namespace app\admin\model\facrm\business;

use think\Model;
use traits\model\SoftDelete;

class Product extends Model
{
    use SoftDelete;

    // 表名
    protected $name = 'facrm_business_product';
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';
    // 定义时间戳字段名
    protected $createTime = 'create_time';
    protected $updateTime = 'update_time';
    protected $deleteTime = 'delete_time';

    /**
     * 关联商品信息
     * @return \think\model\relation\BelongsTo
     */
    public function info()
    {
        return $this->belongsTo('\app\admin\model\facrm\product\Product', 'product_id', 'id');
    }

    public function getPriceAttr($value,$data){
        return $value?$value:0;
    }
}